package com.jiaobuchong.beanstalkd;

import com.dinstone.beanstalkc.*;

/**
 * @author zhoujie
 * Created on 2018-07-14 12:05
 */
public class BeanstalkProducer {
    public static void main(String[] args) {
        Configuration config = new Configuration();
        config.setServiceHost("127.0.0.1");
        config.setServicePort(11300);
        BeanstalkClientFactory factory = new BeanstalkClientFactory(config);
        JobProducer producer = factory.createJobProducer("beanstalkd-demo");
        String msg = "hello, beanstalkd";

        // 返回job id
        long p = producer.putJob(100, 0, 180, msg.getBytes());
        System.out.println(p);
    }
}
